import { deepClone } from "@/utils/common"
import axios from 'axios'
export default {
  state: {
    regionTree: [],
  },
  mutations: {
    SET_REGION_TREE: (state, data) => (state.regionTree = data),
  },
  getters: {
    regionTree: (state) => state.regionTree,
  },
  actions: {
    getRegions: ({ commit }, data) => {
      fetch("./json/regionTree.json")
        .then((rsp) => {
          return rsp.json()
        })
        .then(data => {
          commit('SET_REGION_TREE', deepClone(data))
        })
        .catch(() => {});
    },
  },
};
